<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/7/6 11:15
 */

namespace App\Project\Printer;

use App\Models\PersonalHistory;

class PersonPrinter extends PrinterAbstract
{
    public function __construct(PersonalHistory $person)
    {
        $this->model = $person;
    }

    public function smoke()
    {
        if (!$this->model->smoke) {
            return '';
        }

        $print = [
            $this->fed('smoke', 'time', '持续'),
            $this->fe('smoke', 'many', '每日吸烟', '支烟'),
            $this->fed('stop_smoke', null, '戒烟'),
        ];

        return $this->getPrintStr('吸烟史：', $print);
    }

    public function drink()
    {
        if (!$this->model->drink) {
            return '';
        }

        $print = [
            $this->fed('drink', 'time', '持续'),
            $this->fe('drink', 'whiteSpirit', '每日饮白酒', 'mL'),
            $this->fe('drink', 'redSpirit', '红酒', 'mL'),
            $this->fe('drink', 'beer', '啤酒', 'mL'),
            $this->fed('stop_drink', null, '戒酒'),
        ];

        return $this->getPrintStr('饮酒史：', $print);
    }
}